/**
 *
 * @param {*} phone 数据源
 */
export default function maskPhone(phone: string | null | undefined) {
  if (!phone) return ''
  
  const cleanedPhone = phone.toString().trim()
  
  if (cleanedPhone.length === 11) {
    return cleanedPhone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
  }
  
  return cleanedPhone
}
